

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/fluid.png">
  <link rel="icon" href="/img/fluid.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="深海火锅店">
  <meta name="keywords" content="">
  
    <meta name="description" content="vue项目布局Element-plus HelloWorld组件删掉，再把HomeView内相关的内容删一删，App.vue内样式全部删掉   如果报错，可能是由于权限不够，复制报错信息上网查找解决方案即可  全局引入element-plus 再次运行项目  选择这里的代码，复制到App.vue  1234567891011121314151617181920212223242526&lt;tem">
<meta property="og:type" content="article">
<meta property="og:title" content="03.vue项目布局">
<meta property="og:url" content="http://example.com/2022/12/15/%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80/Java/%E9%A1%B9%E7%9B%AE/%E4%BB%8E%E9%9B%B6%E5%BC%80%E5%A7%8B%E6%90%AD%E5%BB%BA%E5%89%8D%E5%90%8E%E7%AB%AF%E5%88%86%E7%A6%BB%E9%A1%B9%E7%9B%AE/Vue/03.Vue%E9%A1%B9%E7%9B%AE%E7%BB%93%E6%9E%84/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="vue项目布局Element-plus HelloWorld组件删掉，再把HomeView内相关的内容删一删，App.vue内样式全部删掉   如果报错，可能是由于权限不够，复制报错信息上网查找解决方案即可  全局引入element-plus 再次运行项目  选择这里的代码，复制到App.vue  1234567891011121314151617181920212223242526&lt;tem">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946517.png">
<meta property="og:image" content="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946393.png">
<meta property="og:image" content="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946292.png">
<meta property="og:image" content="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946008.png">
<meta property="og:image" content="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946935.png">
<meta property="og:image" content="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946870.png">
<meta property="og:image" content="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946200.png">
<meta property="og:image" content="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946601.png">
<meta property="og:image" content="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946541.png">
<meta property="og:image" content="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201947673.png">
<meta property="og:image" content="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201947968.png">
<meta property="og:image" content="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201947582.png">
<meta property="og:image" content="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201947800.png">
<meta property="article:published_time" content="2022-12-14T16:00:00.000Z">
<meta property="article:modified_time" content="2024-02-15T16:04:48.967Z">
<meta property="article:author" content="深海火锅店">
<meta property="article:tag" content="vue3">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946517.png">
  
  
    <meta name="referrer" content="no-referrer-when-downgrade">
  
  
  <title>03.vue项目布局 - Hexo</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"example.com","root":"/","version":"1.9.3","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"follow_dnt":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
  


  
<meta name="generator" content="Hexo 6.3.0"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>Fluid</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/img/background.jpg') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="03.vue项目布局"></span>
          
        </div>

        
          
  <div class="mt-3">
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2022-12-15 00:00" pubdate>
          2022年12月15日 凌晨
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          14k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          118 分钟
        
      </span>
    

    
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">03.vue项目布局</h1>
            
            
              <div class="markdown-body">
                
                <h2 id="vue项目布局"><a href="#vue项目布局" class="headerlink" title="vue项目布局"></a>vue项目布局</h2><p><a target="_blank" rel="noopener" href="https://element-plus.gitee.io/zh-CN/">Element-plus</a></p>
<p>HelloWorld组件删掉，再把HomeView内相关的内容删一删，App.vue内样式全部删掉</p>
<p><img src="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946517.png" srcset="/img/loading.gif" lazyload alt="1"></p>
<p><img src="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946393.png" srcset="/img/loading.gif" lazyload alt="2"></p>
<p>如果报错，可能是由于权限不够，复制报错信息上网查找解决方案即可</p>
<p><img src="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946292.png" srcset="/img/loading.gif" lazyload alt="3"></p>
<p>全局引入element-plus</p>
<p>再次运行项目</p>
<p><img src="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946008.png" srcset="/img/loading.gif" lazyload alt="4"></p>
<p>选择这里的代码，复制到App.vue</p>
<p><img src="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946935.png" srcset="/img/loading.gif" lazyload alt="6"></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><code class="hljs vue">&lt;template&gt;<br>  &lt;div class=&quot;common-layout&quot;&gt;<br>    &lt;el-container&gt;<br>      &lt;el-header&gt;<br>        Header<br>      &lt;/el-header&gt;<br>      &lt;el-container&gt;<br>        &lt;el-aside width=&quot;200px&quot;&gt;Aside&lt;/el-aside&gt;<br>        &lt;el-main&gt;<br>          &lt;router-view/&gt;<br>        &lt;/el-main&gt;<br>      &lt;/el-container&gt;<br>    &lt;/el-container&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;<br><br>&lt;script lang=&quot;ts&quot;&gt;<br>import &#123;defineComponent&#125; from &#x27;vue&#x27;;<br>export default defineComponent(&#123;<br>  components: &#123;<br>  &#125;,<br>&#125;);<br>&lt;/script&gt;<br><br>&lt;style&gt;<br>&lt;/style&gt;<br></code></pre></td></tr></table></figure>

<p><img src="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946870.png" srcset="/img/loading.gif" lazyload alt="5"></p>
<p>现在就是页面暂时的结构</p>
<p>由于项目会涉及到图标，继续下载</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">npm install @element-plus/icons-vue<br></code></pre></td></tr></table></figure>

<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><code class="hljs js"><span class="hljs-comment">// main.ts</span><br><br><span class="hljs-comment">// 如果您正在使用CDN引入，请删除下面一行。</span><br><span class="hljs-keyword">import</span> * <span class="hljs-keyword">as</span> <span class="hljs-title class_">ElementPlusIconsVue</span> <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@element-plus/icons-vue&#x27;</span><br><br><span class="hljs-keyword">const</span> app = <span class="hljs-title function_">createApp</span>(<span class="hljs-title class_">App</span>)<br><span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> [key, component] <span class="hljs-keyword">of</span> <span class="hljs-title class_">Object</span>.<span class="hljs-title function_">entries</span>(<span class="hljs-title class_">ElementPlusIconsVue</span>)) &#123;<br>  app.<span class="hljs-title function_">component</span>(key, component)<br>&#125;<br></code></pre></td></tr></table></figure>

<p><img src="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946200.png" srcset="/img/loading.gif" lazyload alt="7"></p>
<p>测试一下图标是否安装好了</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><code class="hljs html"><span class="hljs-comment">&lt;!-- Home --&gt;</span><br><span class="hljs-tag">&lt;<span class="hljs-name">el-row</span>&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-name">el-button</span> <span class="hljs-attr">icon</span>=<span class="hljs-string">&quot;Search&quot;</span> <span class="hljs-attr">circle</span>/&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-name">el-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&quot;primary&quot;</span> <span class="hljs-attr">icon</span>=<span class="hljs-string">&quot;Edit&quot;</span> <span class="hljs-attr">circle</span>/&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-name">el-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&quot;success&quot;</span> <span class="hljs-attr">icon</span>=<span class="hljs-string">&quot;Check&quot;</span> <span class="hljs-attr">circle</span>/&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-name">el-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&quot;info&quot;</span> <span class="hljs-attr">icon</span>=<span class="hljs-string">&quot;Message&quot;</span> <span class="hljs-attr">circle</span>/&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-name">el-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&quot;warning&quot;</span> <span class="hljs-attr">icon</span>=<span class="hljs-string">&quot;Star&quot;</span> <span class="hljs-attr">circle</span>/&gt;</span><br>      <span class="hljs-tag">&lt;<span class="hljs-name">el-button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">&quot;danger&quot;</span> <span class="hljs-attr">icon</span>=<span class="hljs-string">&quot;Delete&quot;</span> <span class="hljs-attr">circle</span>/&gt;</span><br><span class="hljs-tag">&lt;/<span class="hljs-name">el-row</span>&gt;</span><br><br>import &#123;<br>  Check,<br>  Delete,<br>  Edit,<br>  Message,<br>  Search,<br>  Star,<br>&#125; from &#x27;@element-plus/icons-vue&#x27;<br><br><span class="hljs-comment">&lt;!-- main.ts --&gt;</span><br>import * as ElementPlusIconsVue from &#x27;@element-plus/icons-vue&#x27;<br><br>for (const [key, component] of Object.entries(ElementPlusIconsVue)) &#123;<br>    app.component(key, component)<br>&#125;<br></code></pre></td></tr></table></figure>

<p><img src="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946601.png" srcset="/img/loading.gif" lazyload alt="8"></p>
<p>可以看到可以正常使用，控制台也没报错</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs vue">&lt;!-- 图标若不显示 --&gt;<br>&lt;!-- 将标签中的 :icon 改为icon即可 --&gt;<br></code></pre></td></tr></table></figure>

<p>新建一个头部组件</p>
<p>component下新建Header.vue</p>
<p><img src="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201946541.png" srcset="/img/loading.gif" lazyload alt="9"></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br></pre></td><td class="code"><pre><code class="hljs vue">&lt;template&gt;<br>  &lt;div style=&quot;height: 50px;line-height: 50px;border-bottom: 1px solid #ccc;display: flex&quot;&gt;<br>    &lt;div style=&quot;width: 200px;padding-left:30px;font-weight: bold;color:dodgerblue&quot;&gt;管理系统&lt;/div&gt;<br>    &lt;div style=&quot;flex: 1&quot;&gt;&lt;/div&gt;<br>    &lt;div style=&quot;width: 150px;margin-top: 10px;&quot;&gt;<br>      &lt;el-dropdown trigger=&quot;click&quot;&gt;<br>        &lt;span class=&quot;el-dropdown-link&quot;&gt;<br>          深海火锅店&lt;el-icon class=&quot;el-icon--right&quot;&gt;&lt;arrow-down/&gt;&lt;/el-icon&gt;<br>        &lt;/span&gt;<br>        &lt;template #dropdown&gt;<br>          &lt;el-dropdown-menu&gt;<br>            &lt;el-dropdown-item icon=&quot;UserFilled&quot;&gt;<br>              个人信息<br>            &lt;/el-dropdown-item&gt;<br>            &lt;el-dropdown-item icon=&quot;SwitchButton&quot; @click=&quot;logout&quot;&gt;<br>              退出登录<br>            &lt;/el-dropdown-item&gt;<br>          &lt;/el-dropdown-menu&gt;<br>        &lt;/template&gt;<br>      &lt;/el-dropdown&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;<br><br>&lt;script lang=&quot;ts&quot;&gt;<br>import &#123;ref&#125; from &#x27;vue&#x27;<br>import &#123; h &#125; from &#x27;vue&#x27;<br>import &#123; ElMessage, ElMessageBox &#125; from &#x27;element-plus&#x27;<br>import &#123;<br>  ArrowDown,<br>  Check,<br>  CircleCheck,<br>  CirclePlus,<br>  CirclePlusFilled,<br>  Plus,<br>&#125; from &#x27;@element-plus/icons-vue&#x27;<br><br>export default &#123;<br>  name: &quot;Header&quot;,<br>  setup() &#123;<br>    const activeIndex = ref(&#x27;1&#x27;)<br>    const activeIndex2 = ref(&#x27;1&#x27;)<br>    const handleSelect = (key: string, keyPath: string[]) =&gt; &#123;<br>      console.log(key, keyPath)<br>    &#125;<br>    const logout=()=&gt;&#123;<br>      ElMessageBox(&#123;<br>        title: &#x27;提示&#x27;,<br>        message: h(&#x27;p&#x27;, null, [<br>          h(&#x27;span&#x27;, null, &#x27;您即将&#x27;),<br>          h(&#x27;i&#x27;, &#123; style: &#x27;color: teal&#x27; &#125;, &#x27;退出登录&#x27;),<br>        ]),<br>        showCancelButton: true,<br>        confirmButtonText: &#x27;确认&#x27;,<br>        cancelButtonText: &#x27;取消&#x27;,<br>        beforeClose: (action, instance, done) =&gt; &#123;<br>          if (action === &#x27;confirm&#x27;) &#123;<br>            instance.confirmButtonLoading = true<br>            instance.confirmButtonText = &#x27;Loading...&#x27;<br>            setTimeout(() =&gt; &#123;<br>              done()<br>              setTimeout(() =&gt; &#123;<br>                instance.confirmButtonLoading = false<br>              &#125;, 300)<br>            &#125;, 3000)<br>          &#125; else &#123;<br>            done()<br>          &#125;<br>        &#125;,<br>      &#125;).then((action) =&gt; &#123;<br>        ElMessage(&#123;<br>          type: &#x27;info&#x27;,<br>          message: `action: $&#123;action&#125;`,<br>        &#125;)<br>      &#125;)<br>    &#125;<br>    return &#123;activeIndex, activeIndex2, handleSelect,logout&#125;<br>  &#125;<br>&#125;<br>&lt;/script&gt;<br><br>&lt;style scoped&gt;<br>&lt;/style&gt;<br></code></pre></td></tr></table></figure>

<p>暂时是定死了名字，用户名字是深海火锅店，以后再更改</p>
<p>此时我们发现文字和顶部之间有一段距离</p>
<p>在asset下新建css文件夹，css下新建global.css文件【右键新建，stylesheet，选择add】</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs css">*&#123;<br>    <span class="hljs-attribute">margin</span>: <span class="hljs-number">0</span>;<br>    <span class="hljs-attribute">padding</span>: <span class="hljs-number">0</span>;<br>    <span class="hljs-attribute">box-sizing</span>: border-box;<br>&#125;<br></code></pre></td></tr></table></figure>

<p>在main.ts中引入</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><code class="hljs js"><span class="hljs-comment">// import &#x27;@/assets/css/global.css&#x27;添加这句话--------------</span><br><br><span class="hljs-keyword">import</span> &#123; createApp &#125; <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;vue&#x27;</span><br><span class="hljs-keyword">import</span> <span class="hljs-title class_">App</span> <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;./App.vue&#x27;</span><br><span class="hljs-keyword">import</span> router <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;./router&#x27;</span><br><span class="hljs-keyword">import</span> store <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;./store&#x27;</span><br><span class="hljs-keyword">import</span> <span class="hljs-title class_">ElementPlus</span> <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;element-plus&#x27;</span><br><span class="hljs-keyword">import</span> <span class="hljs-string">&#x27;element-plus/dist/index.css&#x27;</span><br><span class="hljs-keyword">import</span> * <span class="hljs-keyword">as</span> <span class="hljs-title class_">ElementPlusIconsVue</span> <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;@element-plus/icons-vue&#x27;</span><br><span class="hljs-keyword">import</span> <span class="hljs-string">&#x27;@/assets/css/global.css&#x27;</span><br><span class="hljs-comment">// @ts-ignore</span><br><span class="hljs-keyword">import</span> zhCn <span class="hljs-keyword">from</span> <span class="hljs-string">&#x27;element-plus/dist/locale/zh-cn.mjs&#x27;</span><br><br><span class="hljs-keyword">const</span> app = <span class="hljs-title function_">createApp</span>(<span class="hljs-title class_">App</span>)<br>app.<span class="hljs-title function_">use</span>(store)<br>app.<span class="hljs-title function_">use</span>(router)<br>app.<span class="hljs-title function_">use</span>(<span class="hljs-title class_">ElementPlus</span>)<br><span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> [key, component] <span class="hljs-keyword">of</span> <span class="hljs-title class_">Object</span>.<span class="hljs-title function_">entries</span>(<span class="hljs-title class_">ElementPlusIconsVue</span>)) &#123;<br>    app.<span class="hljs-title function_">component</span>(key, component)<br>&#125;<br>app.<span class="hljs-title function_">mount</span>(<span class="hljs-string">&#x27;#app&#x27;</span>)<br>app.<span class="hljs-title function_">use</span>(<span class="hljs-title class_">ElementPlus</span>, &#123;<br>    <span class="hljs-attr">locale</span>: zhCn,<br>&#125;)<br></code></pre></td></tr></table></figure>

<p>再新建左侧导航栏Aside.vue</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br></pre></td><td class="code"><pre><code class="hljs vue">&lt;template&gt;<br>  &lt;el-menu<br>      default-active=&quot;2&quot;<br>      class=&quot;el-menu-vertical-demo&quot;<br>      @open=&quot;handleOpen&quot;<br>      @close=&quot;handleClose&quot;&gt;<br>    &lt;el-sub-menu index=&quot;1&quot;&gt;<br>      &lt;template #title&gt;<br>        &lt;el-icon&gt;<br>          &lt;location/&gt;<br>        &lt;/el-icon&gt;<br>        &lt;span&gt;学生信息管理&lt;/span&gt;<br>      &lt;/template&gt;<br>      &lt;el-menu-item-group title=&quot;Group One&quot;&gt;<br>        &lt;el-menu-item index=&quot;1-1&quot;&gt;item one&lt;/el-menu-item&gt;<br>        &lt;el-menu-item index=&quot;1-2&quot;&gt;item two&lt;/el-menu-item&gt;<br>      &lt;/el-menu-item-group&gt;<br>      &lt;el-menu-item-group title=&quot;Group Two&quot;&gt;<br>        &lt;el-menu-item index=&quot;1-3&quot;&gt;item three&lt;/el-menu-item&gt;<br>      &lt;/el-menu-item-group&gt;<br>      &lt;el-sub-menu index=&quot;1-4&quot;&gt;<br>        &lt;template #title&gt;item four&lt;/template&gt;<br>        &lt;el-menu-item index=&quot;1-4-1&quot;&gt;item one&lt;/el-menu-item&gt;<br>      &lt;/el-sub-menu&gt;<br>    &lt;/el-sub-menu&gt;<br>    &lt;el-menu-item index=&quot;2&quot;&gt;<br>      &lt;el-icon&gt;<br>        &lt;icon-menu/&gt;<br>      &lt;/el-icon&gt;<br>      &lt;span&gt;Navigator Two&lt;/span&gt;<br>    &lt;/el-menu-item&gt;<br>    &lt;el-menu-item index=&quot;3&quot; disabled&gt;<br>      &lt;el-icon&gt;<br>        &lt;document/&gt;<br>      &lt;/el-icon&gt;<br>      &lt;span&gt;Navigator Three&lt;/span&gt;<br>    &lt;/el-menu-item&gt;<br>    &lt;el-menu-item index=&quot;4&quot;&gt;<br>      &lt;el-icon&gt;<br>        &lt;setting/&gt;<br>      &lt;/el-icon&gt;<br>      &lt;span&gt;Navigator Four&lt;/span&gt;<br>    &lt;/el-menu-item&gt;<br>  &lt;/el-menu&gt;<br>&lt;/template&gt;<br><br>&lt;script lang=&quot;ts&quot;&gt;<br>import &#123;<br>  Document,<br>  Menu as IconMenu,<br>  Location,<br>  Setting,<br>&#125; from &#x27;@element-plus/icons-vue&#x27;<br><br>export default &#123;<br>  name: &quot;Aside&quot;,<br>  setup() &#123;<br>    const handleOpen = (key: string, keyPath: string[]) =&gt; &#123;<br>      console.log(key, keyPath)<br>    &#125;<br>    const handleClose = (key: string, keyPath: string[]) =&gt; &#123;<br>      console.log(key, keyPath)<br>    &#125;<br>    return &#123;handleOpen, handleClose&#125;<br>  &#125;<br>&#125;<br>&lt;/script&gt;<br><br>&lt;style scoped&gt;<br><br>&lt;/style&gt;<br></code></pre></td></tr></table></figure>

<p>在App.vue中引入header、aside组件</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br></pre></td><td class="code"><pre><code class="hljs vue">&lt;template&gt;<br>  &lt;el-config-provider :locale=&quot;locale&quot;&gt;<br>    &lt;slot name=&quot;app&quot;&gt;<br>      &lt;div class=&quot;common-layout&quot;&gt;<br>        &lt;el-container&gt;<br>          &lt;el-header&gt;<br>            &lt;Header/&gt;<br>          &lt;/el-header&gt;<br>          &lt;el-container&gt;<br>            &lt;el-aside width=&quot;250px&quot;&gt;<br>              &lt;Aside/&gt;<br>            &lt;/el-aside&gt;<br>            &lt;el-main&gt;<br>              &lt;router-view/&gt;<br>            &lt;/el-main&gt;<br>          &lt;/el-container&gt;<br>        &lt;/el-container&gt;<br>      &lt;/div&gt;<br>    &lt;/slot&gt;<br>  &lt;/el-config-provider&gt;<br>&lt;/template&gt;<br><br>&lt;script lang=&quot;ts&quot;&gt;<br>import &#123;defineComponent&#125; from &#x27;vue&#x27;;<br>import Header from &quot;@/components/Header.vue&quot;;<br>import Aside from &quot;@/components/Aside.vue&quot;;<br>import &#123; ElConfigProvider &#125; from &#x27;element-plus&#x27;<br>// 国际化：设置为中文<br>// begin----<br>import zhCn from &#x27;element-plus/lib/locale/lang/zh-cn&#x27;<br>export default defineComponent(&#123;<br>  name: &#x27;ZhProvider&#x27;,<br>  components: &#123;<br>    Header,<br>    Aside,<br>    [ElConfigProvider.name]: ElConfigProvider<br>  &#125;,<br>  setup() &#123;<br>    let locale = zhCn<br>    return &#123;<br>      locale<br>    &#125;<br>  &#125;<br>&#125;);<br>// end----<br>&lt;/script&gt;<br><br>&lt;style&gt;<br>&lt;/style&gt;<br><br></code></pre></td></tr></table></figure>

<p>最后完成主页面HomeView.vue</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br></pre></td><td class="code"><pre><code class="hljs vue">&lt;template&gt;<br>  &lt;!--功能区域--&gt;<br>  &lt;div&gt;<br>    &lt;el-button type=&quot;info&quot; icon=&quot;Plus&quot; @click=&quot;openAdd&quot;&gt;新增&lt;/el-button&gt;<br>    &lt;el-button type=&quot;info&quot; icon=&quot;Upload&quot;&gt;导入&lt;/el-button&gt;<br>    &lt;el-button type=&quot;info&quot; icon=&quot;Download&quot;&gt;导出&lt;/el-button&gt;<br>  &lt;/div&gt;<br>  &lt;!--搜索区域--&gt;<br>  &lt;div style=&quot;margin: 10px 0&quot;&gt;<br>    &lt;el-input v-model=&quot;search&quot; placeholder=&quot;请输入关键字&quot; style=&quot;width: 25%&quot; clearable/&gt;<br>    &lt;el-button type=&quot;primary&quot; style=&quot;margin-left: 5px&quot; icon=&quot;Search&quot;&gt;搜索&lt;/el-button&gt;<br>  &lt;/div&gt;<br>  &lt;el-table :data=&quot;tableData&quot; style=&quot;width: 100%&quot;&gt;<br>    &lt;el-table-column fixed prop=&quot;date&quot; label=&quot;日期&quot; width=&quot;150&quot; sortable/&gt;<br>    &lt;el-table-column prop=&quot;name&quot; label=&quot;姓名&quot; width=&quot;120&quot;/&gt;<br>    &lt;el-table-column prop=&quot;age&quot; label=&quot;年龄&quot; width=&quot;120&quot; sortable/&gt;<br>    &lt;el-table-column prop=&quot;gender&quot; label=&quot;性别&quot; width=&quot;120&quot;/&gt;<br>    &lt;el-table-column prop=&quot;college&quot; label=&quot;学院&quot; width=&quot;120&quot;/&gt;<br>    &lt;el-table-column prop=&quot;address&quot; label=&quot;地址&quot; width=&quot;300&quot;/&gt;<br>    &lt;el-table-column prop=&quot;state&quot; label=&quot;状态&quot; width=&quot;120&quot;/&gt;<br>    &lt;el-table-column fixed=&quot;right&quot; label=&quot;操作&quot; width=&quot;150&quot;&gt;<br>      &lt;template #default&gt;<br>        &lt;el-popconfirm type=&quot;warning&quot; title=&quot;确认删除此选项?&quot;&gt;<br>          &lt;template #reference&gt;<br>            &lt;el-button link type=&quot;warning&quot; size=&quot;small&quot;&gt;删除&lt;/el-button&gt;<br>          &lt;/template&gt;<br>        &lt;/el-popconfirm&gt;<br>        &lt;el-button link type=&quot;primary&quot; plain size=&quot;small&quot; @click=&quot;handleClick&quot;&gt;查看&lt;/el-button&gt;<br>        &lt;el-button link type=&quot;info&quot; size=&quot;small&quot; @click=&quot;editMsg&quot;&gt;编辑&lt;/el-button&gt;<br>      &lt;/template&gt;<br>    &lt;/el-table-column&gt;<br>  &lt;/el-table&gt;<br><br>  &lt;hr class=&quot;my-4&quot;/&gt;<br>  &lt;!--分页区域--&gt;<br>  &lt;div class=&quot;demo-pagination-block&quot; style=&quot;margin: 5px&quot;&gt;<br>    &lt;el-pagination<br>        v-model:current-page=&quot;currentPage&quot;<br>        v-model:page-size=&quot;pageSize&quot;<br>        :page-sizes=&quot;[100, 200, 300, 400]&quot;<br>        :small=&quot;small&quot;<br>        layout=&quot;total, sizes, prev, pager, next, jumper&quot;<br>        :total=&quot;400&quot;<br>        @size-change=&quot;handleSizeChange&quot;<br>        @current-change=&quot;handleCurrentChange&quot;/&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;<br><br>&lt;script lang=&quot;ts&quot;&gt;<br>import &#123;defineComponent&#125; from &#x27;vue&#x27;;<br>import &#123;h,ref&#125; from &#x27;vue&#x27;<br>import &#123; ElMessage, ElMessageBox &#125; from &#x27;element-plus&#x27;<br>import &#123; UploadFilled &#125; from &#x27;@element-plus/icons-vue&#x27;<br><br>export default defineComponent(&#123;<br>  name: &#x27;HomeView&#x27;,<br>  components: &#123;&#125;,<br>  setup() &#123;<br>    /* 查看信息 */<br>    const handleClick = () =&gt; &#123;<br>      console.log(&#x27;click&#x27;)<br>      ElMessageBox(&#123;<br>        title: &#x27;信息&#x27;,<br>        message: h(&#x27;p&#x27;, null, [<br>          h(&#x27;span&#x27;, null, &#x27;Message can be &#x27;),<br>          h(&#x27;i&#x27;, &#123; style: &#x27;color: teal&#x27; &#125;, &#x27;VNode&#x27;),<br>        ]),<br>      &#125;)<br>    &#125;<br><br>    /* 编辑信息 */<br>    const editMsg = () =&gt; &#123;<br>      ElMessageBox.confirm(<br>          &#x27;您正在修改他人的个人信息. 是否继续?&#x27;,<br>          &#x27;警告&#x27;,<br>          &#123;<br>            confirmButtonText: &#x27;确认&#x27;,<br>            cancelButtonText: &#x27;取消&#x27;,<br>            type: &#x27;warning&#x27;,<br>          &#125;<br>      )<br>          .then(() =&gt; &#123;<br>            ElMessage(&#123;<br>              type: &#x27;success&#x27;,<br>              message: &#x27;修改成功&#x27;,<br>            &#125;)<br>          &#125;)<br>          .catch(() =&gt; &#123;<br>            ElMessage(&#123;<br>              type: &#x27;info&#x27;,<br>              message: &#x27;取消修改&#x27;,<br>            &#125;)<br>          &#125;)<br>    &#125;<br>    const search = ref(&quot;&quot;);<br><br>    const tableData = [<br>      &#123;<br>        date: &#x27;2016-05-03&#x27;,<br>        name: &#x27;Tom&#x27;,<br>        age: &#x27;12&#x27;,<br>        gender: &#x27;女&#x27;,<br>        college: &#x27;自动化&#x27;,<br>        address: &#x27;No. 189, Grove St, Los Angeles&#x27;,<br>        state: &#x27;24小时阴性&#x27;,<br>      &#125;,<br>      &#123;<br>        date: &#x27;2016-05-03&#x27;,<br>        name: &#x27;Tom&#x27;,<br>        age: &#x27;15&#x27;,<br>        gender: &#x27;男&#x27;,<br>        college: &#x27;经管&#x27;,<br>        address: &#x27;No. 189, Grove St, Los Angeles&#x27;,<br>        state: &#x27;24小时阴性&#x27;,<br>      &#125;,<br>      &#123;<br>        date: &#x27;2016-05-03&#x27;,<br>        name: &#x27;Tom&#x27;,<br>        age: &#x27;12&#x27;,<br>        gender: &#x27;女&#x27;,<br>        college: &#x27;计算机&#x27;,<br>        address: &#x27;No. 189, Grove St, Los Angeles&#x27;,<br>        state: &#x27;24小时阴性&#x27;,<br>      &#125;,<br>      &#123;<br>        date: &#x27;2016-05-03&#x27;,<br>        name: &#x27;Tom&#x27;,<br>        age: &#x27;16&#x27;,<br>        gender: &#x27;男&#x27;,<br>        college: &#x27;软件工程&#x27;,<br>        address: &#x27;No. 189, Grove St, Los Angeles&#x27;,<br>        state: &#x27;24小时阴性&#x27;,<br>      &#125;,<br>    ]<br>    const currentPage = ref(1)<br>    const pageSize = ref(100)<br>    const small = ref(false)<br><br>    const handleSizeChange = (val: number) =&gt; &#123;<br>      console.log(`$&#123;val&#125; items per page`)<br>    &#125;<br>    const handleCurrentChange = (val: number) =&gt; &#123;<br>      console.log(`current page: $&#123;val&#125;`)<br>    &#125;<br><br>    /* 消息弹出框 */<br>    const openAdd = () =&gt; &#123;<br>      ElMessageBox.confirm(<br>          &#x27;您希望添加如下内容?&#x27;,<br>          &#x27;提示&#x27;,<br>          &#123;<br>            confirmButtonText: &#x27;确定&#x27;,<br>            cancelButtonText: &#x27;取消&#x27;,<br>            type: &#x27;warning&#x27;,<br>            draggable: true,<br>          &#125;<br>      )<br>          .then(() =&gt; &#123;<br>            ElMessage(&#123;<br>              type: &#x27;success&#x27;,<br>              message: &#x27;Delete completed&#x27;,<br>            &#125;)<br>          &#125;)<br>          .catch(() =&gt; &#123;<br>            ElMessage(&#123;<br>              type: &#x27;info&#x27;,<br>              message: &#x27;Delete canceled&#x27;,<br>            &#125;)<br>          &#125;)<br>    &#125;<br><br>    return &#123;<br>      handleClick,<br>      editMsg,<br>      tableData,<br>      search,<br>      currentPage,<br>      pageSize,<br>      small,<br>      handleSizeChange,<br>      handleCurrentChange,<br>      openAdd<br>    &#125;<br>  &#125;<br>&#125;);<br>&lt;/script&gt;<br></code></pre></td></tr></table></figure>

<p><img src="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201947673.png" srcset="/img/loading.gif" lazyload alt="10"></p>
<p><img src="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201947968.png" srcset="/img/loading.gif" lazyload alt="11"></p>
<p><img src="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201947582.png" srcset="/img/loading.gif" lazyload alt="12"></p>
<p><img src="https://gitee.com/tongstyle/blog-img/raw/master/img/202301201947800.png" srcset="/img/loading.gif" lazyload alt="13"></p>
<p>链接：<a target="_blank" rel="noopener" href="https://pan.baidu.com/s/11qXNPDQ_87TKmvF8R_RlrQ?pwd=m9fn">https://pan.baidu.com/s/11qXNPDQ_87TKmvF8R_RlrQ?pwd=m9fn</a><br>提取码：m9fn<br>–来自百度网盘超级会员V3的分享</p>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/categories/%E5%89%8D%E5%90%8E%E7%AB%AF%E5%88%86%E7%A6%BB/" class="category-chain-item">前后端分离</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/tags/vue3/">#vue3</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>03.vue项目布局</div>
      <div>http://example.com/2022/12/15/编程语言/Java/项目/从零开始搭建前后端分离项目/Vue/03.Vue项目结构/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>深海火锅店</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2022年12月15日</div>
        </div>
      
      
      
        <div class="license-meta-item">
          <div>许可协议</div>
          <div>
            
              
              
                <a target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
                  <span class="hint--top hint--rounded" aria-label="BY - 署名">
                    <i class="iconfont icon-by"></i>
                  </span>
                </a>
              
            
          </div>
        </div>
      
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2022/12/16/%E7%B3%BB%E7%BB%9F%E9%85%8D%E7%BD%AE/%E7%BC%96%E7%A8%8B%E9%85%8D%E7%BD%AE/%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE/Idea%E9%85%8D%E7%BD%AE/idea%E5%A5%BD%E7%94%A8%E7%9A%84%E6%8F%92%E4%BB%B6/" title="idea推介插件">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">idea推介插件</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2022/12/14/%E7%B3%BB%E7%BB%9F%E9%85%8D%E7%BD%AE/%E7%BC%96%E7%A8%8B%E9%85%8D%E7%BD%AE/%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE/Docker%E9%85%8D%E7%BD%AE/docker%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE/" title="docker配置">
                        <span class="hidden-mobile">docker配置</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
    </div>
  
  
    <div class="statistics">
  
  

  
    
      <span id="busuanzi_container_site_pv" style="display: none">
        总访问量 
        <span id="busuanzi_value_site_pv"></span>
         次
      </span>
    
    
      <span id="busuanzi_container_site_uv" style="display: none">
        总访客数 
        <span id="busuanzi_value_site_uv"></span>
         人
      </span>
    
    
  
</div>

  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.18.2/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init(Object.assign({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      scrollSmooth    : true,
      includeTitleTags: true,
      headingsOffset  : -boardTop,
    }, CONFIG.toc));
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }

    Fluid.events.registerRefreshCallback(function() {
      if ('tocbot' in window) {
        tocbot.refresh();
        var toc = jQuery('#toc');
        if (toc.length === 0 || !tocbot) {
          return;
        }
        if (toc.find('.toc-list-item').length > 0) {
          toc.css('visibility', 'visible');
        }
      }
    });
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.11/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));

    Fluid.events.registerRefreshCallback(function() {
      if ('anchors' in window) {
        anchors.removeAll();
        var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
        var res = [];
        for (var item of el) {
          res.push('.markdown-body > ' + item.trim());
        }
        if (CONFIG.anchorjs.placement === 'left') {
          anchors.options.class = 'anchorjs-link-left';
        }
        anchors.add(res.join(', '));
      }
    });
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/js/local-search.js" ></script>

  <script defer src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" ></script>




  
<script src="//cdn.jsdelivr.net/gh/EmoryHuang/BlogBeautify@1.1/DynamicRibbon.min.js"></script>



<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
